package com.itheima.register.dao;

import com.itheima.register.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface UserMapper {

    //用户登录
    @Select("select id,username,password from user where username=#{username} and password=#{password}")
    User findUserByNameAndPwd(@Param("username") String username,@Param("password") String password);

    //查询用户是否存在
    @Select("select id,username,password from user where username=#{name}")
    User findUserByName(String name);

    //添加用户
    @Insert("insert into user (username,password) values(#{username},#{password})")
    int addUser(User user);
}
